#pragma once

#include "util/collector/collector.h"

#include "part.h"

namespace html::tmplt
{

class Cutter
{
private:
    enum class State
    {
        Text,
        DollarFound,
        FirstLeftBraceFound,
        Template,
        FirstRightBraceFound,
    };

public:
    Cutter(Collector<Part> &parts)
        : parts_(parts) {
    }

    void feed(char c);

    void stop();

private:
    Collector<Part> &parts_;
    State st_ = State::Text;
    std::string buffer_;
};

} // namespace html::tmplt
